UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AZkaK+rZKEeDy/HdvIg3KvcLnyuYIJyMbs3VX7QIEGI=' 
WHERE 
  key_id = '2a2177b84bc7d9a77b631a8fbe8d2951f33c1627751a44e6d40dcd08be6a1a4a' 
  AND (
    token = 'AZkaK+rZKEeDy/HdvIg3KvcLnyuYIJyMbs3VX7QIEGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036