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

Query time 0.00031