UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rFQYyqoFRJRM13CXTAQgAE840cVKTFe+rCbg8B/JzFU=' 
WHERE 
  key_id = '51df32e556566dfc3814f41870bb97db3c693f194081610d453efc2b0ae8fd74' 
  AND (
    token = 'rFQYyqoFRJRM13CXTAQgAE840cVKTFe+rCbg8B/JzFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031