UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MUAmeKyXV8uY/KInwuhXNGAiWGXj5aZAxcnw53vpAh4=' 
WHERE 
  key_id = '9d047f70d475144b6d651abf84d5a7893ba82cca90739da86cdd2827e4cadfec' 
  AND (
    token = 'MUAmeKyXV8uY/KInwuhXNGAiWGXj5aZAxcnw53vpAh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037