UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd6UJFB+whG9UvXwsmZpHklnE8EIgL9mXu10D5c4F7D0='
WHERE
key_id = 'bab381b3b99cb2914a0e59124dccd269e3af3bee4bd881811271612b45a33837'
AND (
token = 'd6UJFB+whG9UvXwsmZpHklnE8EIgL9mXu10D5c4F7D0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)