UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k0PY9puXOOFDQZc24pbytkeOcBMLjlJg9pUA2HX01JU='
WHERE
key_id = '5af968b6ab9475b449a4cf98e532da1a60ee36fef72d84024d0988cb4ca27264'
AND (
token = 'k0PY9puXOOFDQZc24pbytkeOcBMLjlJg9pUA2HX01JU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)