UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NO4ThEDy9C/Mqd9wO/VMk3rUhh8yyQII6II2EFH2NTU=' 
WHERE 
  key_id = 'ed6696c35f21e79b52f6d74200a0303c8be95772a1315e4ae6231193143928b7' 
  AND (
    token = 'NO4ThEDy9C/Mqd9wO/VMk3rUhh8yyQII6II2EFH2NTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041