UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S60J3LxZkp5NWqSNhHRW8+zOB2YjFUDebTuZdWeFD8U='
WHERE
key_id = '50022eb3c44249db933993e98c36860a1c4bcd798eddf2d448c8b001efc655e7'
AND (
token = 'S60J3LxZkp5NWqSNhHRW8+zOB2YjFUDebTuZdWeFD8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)