UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y8vKR69oxuwIoURG808D/ec4SlAfJuOcT/NXucL7hbI='
WHERE
key_id = '34045e3551aaf6de994b276398bc3de9128fe9eee72b810e076a7760f2c46da6'
AND (
token = 'y8vKR69oxuwIoURG808D/ec4SlAfJuOcT/NXucL7hbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)