UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R5aetcbxYa44TDrpkW6M2AR7vZ++MeJzdZ58z9hgkgA='
WHERE
key_id = '7c316dc88ec05895fee34699a9effcd905c384624f62d4d3a23772ccca68960e'
AND (
token = 'R5aetcbxYa44TDrpkW6M2AR7vZ++MeJzdZ58z9hgkgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)