UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5Po0BWD8z5qihjFqNXB3ZxY0Bwqoxcw8BZCm35azHsE='
WHERE
key_id = '9341605c5c9df0a348189af9f6695826ae35a1e53e125dc63a4b184471ab2d78'
AND (
token = '5Po0BWD8z5qihjFqNXB3ZxY0Bwqoxcw8BZCm35azHsE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)