UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zr4vmDzDvCJEpHoLj7kCLTZ4ELZoD8UbuOjyjbYsnAg=' 
WHERE 
  key_id = '24f44d2787298cb947a0b6268ecd06ef3d27c30b7beb14d2835beb79d5918896' 
  AND (
    token = 'Zr4vmDzDvCJEpHoLj7kCLTZ4ELZoD8UbuOjyjbYsnAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032