UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VX12VtCLxXOM2EX3tP5gq8ILwLI0BJXDmTL7CoozeqI=' 
WHERE 
  key_id = 'b8bf42fd5d23f78d02d41005792bbb15b61f8b5ec072df15bd5f750a09301cc6' 
  AND (
    token = 'VX12VtCLxXOM2EX3tP5gq8ILwLI0BJXDmTL7CoozeqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035