UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8pOyw2fowwya1t8MRUTowcLntmAIq7cxck8P9ZEj1zs='
WHERE
key_id = '4be148ff74993dc7af55cd8ff5a4600d17379f24a88b6b49a03427144f9f927c'
AND (
token = '8pOyw2fowwya1t8MRUTowcLntmAIq7cxck8P9ZEj1zs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)