UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Lw090YTEZZeMt0nlakvhCA1icL0J4GYZcWYNwHqNTU='
WHERE
key_id = '6311bea6f2e2865cfc77145d104592b6c314d2053598879fb69f9c5f0f8a5014'
AND (
token = '3Lw090YTEZZeMt0nlakvhCA1icL0J4GYZcWYNwHqNTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)