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