UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iyuOja8wXklOL6fcQa9X/PJb8+jcDB3RSSr8SvygIVw='
WHERE
key_id = 'e2824fa95d4ede8c65338d7562fa60e90baeb9120331e0e932ef69708bda80c7'
AND (
token = 'iyuOja8wXklOL6fcQa9X/PJb8+jcDB3RSSr8SvygIVw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)