UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B813f0v/tIP+5GK9/CS6/psJcuthpwe7PrYQrhm4dkY='
WHERE
key_id = 'f5f6d31c84cb9d7ef535839803ab8697c9885c4832d3b500ef7865c072e26395'
AND (
token = 'B813f0v/tIP+5GK9/CS6/psJcuthpwe7PrYQrhm4dkY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)