UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M86i/r9x4b3EpT5c0vsgzBm/P7IqK4kRc7Gci+W7ols=' 
WHERE 
  key_id = '371539f9bf85463761ed9d17da5b89bfe3b4598d30bcd54e91e32646439fe0ba' 
  AND (
    token = 'M86i/r9x4b3EpT5c0vsgzBm/P7IqK4kRc7Gci+W7ols=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030