UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r2DBSxWas8zPi5oT0pr4PkvGhPL4g5fNBtJMRjuvKbU=' 
WHERE 
  key_id = '6d6345e51c23c04e58a9c42ad8658448325a356b8b8c61985367b3b1bd0f7513' 
  AND (
    token = 'r2DBSxWas8zPi5oT0pr4PkvGhPL4g5fNBtJMRjuvKbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032