UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AR55rW22XiJL7sPsoKu2UlSQbvo3y2/ZcwoRob+9PE4=' 
WHERE 
  key_id = '78be671e78ddcff89ef729f3b7e965c8d562ab114c11026c2f53e6f69b927e3a' 
  AND (
    token = 'AR55rW22XiJL7sPsoKu2UlSQbvo3y2/ZcwoRob+9PE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043