UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'us8MG95iMCUd7hPnB57rVUup6YS8rRTHXLsC65VUP5A='
WHERE
key_id = '8277d226d802abb83b7fe596af1016c23c8aa0dda9747615e8aada7dbd58f367'
AND (
token = 'us8MG95iMCUd7hPnB57rVUup6YS8rRTHXLsC65VUP5A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)