UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SgMHCrj8HN/Q2YLqnGsnypb8PBhUPjSj/XUiPWv0OkY='
WHERE
key_id = 'd88d57b4aabac49261bd9067300afb5da846b0564951b8bdb75ec51990ebf760'
AND (
token = 'SgMHCrj8HN/Q2YLqnGsnypb8PBhUPjSj/XUiPWv0OkY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)