UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E3Rf8reoCYELjWjNmg9qNAd8Y/kijlMdBp731XTKmGs='
WHERE
key_id = 'e5c301a90805ff991546ae8aa554f5898a00c36a92028dd56103f10e93a84cef'
AND (
token = 'E3Rf8reoCYELjWjNmg9qNAd8Y/kijlMdBp731XTKmGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)