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

Query time 0.00032