UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IgXHbBRIfY4qrXIcj+c+dSITIA74j8Cevon5R0f/nVY=' 
WHERE 
  key_id = '65119ad8ba9b12156b62945bc1ed99661c2193c06722d3ee27b1d296edf89610' 
  AND (
    token = 'IgXHbBRIfY4qrXIcj+c+dSITIA74j8Cevon5R0f/nVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035