UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xsLdAjAmIfL7rltreASJy3nIujOYP16HKYvOVY7oYok='
WHERE
key_id = 'beb3e527b3894042e3e124cad1c6c5b098be080340ea1c9e545a2aa8dd0395f1'
AND (
token = 'xsLdAjAmIfL7rltreASJy3nIujOYP16HKYvOVY7oYok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)