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

Query time 0.00039