UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dyf26rVEkIEFQnBabUOPIIJMH6UWNEdJssycA8xT4jw=' 
WHERE 
  key_id = '436d3591c931143717ddeff7f1f946f6b531ef323ae431e4c910e399352b3646' 
  AND (
    token = 'Dyf26rVEkIEFQnBabUOPIIJMH6UWNEdJssycA8xT4jw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046