UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hE/T49Sk8aqTtgaG4pjp8hSlDZgiHpY52I23rOib0AM='
WHERE
key_id = '440a2e5726481340f26fc05d295f1d256d14a5ac4de0f0526f536c0958c78a8b'
AND (
token = 'hE/T49Sk8aqTtgaG4pjp8hSlDZgiHpY52I23rOib0AM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)