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