UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Fe7eSo88cy3ii4Gtsbtdn0C27HVyplINp+RK2bSyVLU='
WHERE
key_id = '1d1d118cc123f0e8619c84cf93e9493cc4d643d61640d1ed322d17178133ed02'
AND (
token = 'Fe7eSo88cy3ii4Gtsbtdn0C27HVyplINp+RK2bSyVLU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)