UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qutXvK1oiDLVJj609I7kuXIXIeMEEPvZCKuRAwMSWOA='
WHERE
key_id = 'e301339fe70c5dcfec337158d55b4b807566fa214a00164967a80280d01f5550'
AND (
token = 'qutXvK1oiDLVJj609I7kuXIXIeMEEPvZCKuRAwMSWOA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)