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

Query time 0.00032