UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ThCorvwIdwuA9iL3EAVG7SF0Shfu1ch/YYBOLHIOWJg=' 
WHERE 
  key_id = '11fa9c217559fac321cdebb051196c2da0b7c4f0378376cf81c23ea3d955c9d7' 
  AND (
    token = 'ThCorvwIdwuA9iL3EAVG7SF0Shfu1ch/YYBOLHIOWJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021