UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S+L0RxzL8wnJ/TGvUtwEVsBORvFp4D+SITiMDz9uggE='
WHERE
key_id = '216929f4467f8304150c2fd8408de57edde0f8440d87238e1c3b08e3a946374d'
AND (
token = 'S+L0RxzL8wnJ/TGvUtwEVsBORvFp4D+SITiMDz9uggE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)